
<h1><span class="yiyi-st" id="yiyi-14">numpy.polynomial.legendre.legfromroots</span></h1>
        <blockquote>
        <p>原文：<a href="https://docs.scipy.org/doc/numpy/reference/generated/numpy.polynomial.legendre.legfromroots.html">https://docs.scipy.org/doc/numpy/reference/generated/numpy.polynomial.legendre.legfromroots.html</a></p>
        <p>译者：<a href="https://github.com/wizardforcel">飞龙</a> <a href="http://usyiyi.cn/">UsyiyiCN</a></p>
        <p>校对：（虚位以待）</p>
        </blockquote>
    
<dl class="function">
<dt id="numpy.polynomial.legendre.legfromroots"><span class="yiyi-st" id="yiyi-15"> <code class="descclassname">numpy.polynomial.legendre.</code><code class="descname">legfromroots</code><span class="sig-paren">(</span><em>roots</em><span class="sig-paren">)</span><a class="reference external" href="http://github.com/numpy/numpy/blob/v1.11.3/numpy/polynomial/legendre.py#L266-L329"><span class="viewcode-link">[source]</span></a></span></dt>
<dd><p><span class="yiyi-st" id="yiyi-16">生成具有给定根的Legendre系列。</span></p>
<p><span class="yiyi-st" id="yiyi-17">该函数返回多项式的系数</span></p>
<div class="math">
<p></p>
</div><p><span class="yiyi-st" id="yiyi-18">，其中<em class="xref py py-obj">r_n</em>是在<em class="xref py py-obj">根</em>中指定的根。</span><span class="yiyi-st" id="yiyi-19">如果零具有多重性n，则它必须出现在<em class="xref py py-obj">根</em>中n次。</span><span class="yiyi-st" id="yiyi-20">例如，如果2是多重性三的根，3是多重性2的根，则<em class="xref py py-obj">根</em>看起来像[2,2,2,3,3]。</span><span class="yiyi-st" id="yiyi-21">根可以以任何顺序出现。</span></p>
<p><span class="yiyi-st" id="yiyi-22">如果返回的系数是<em class="xref py py-obj">c</em>，则</span></p>
<div class="math">
<p></p>
</div><p><span class="yiyi-st" id="yiyi-23">对于Legendre形式的单项多项式，最后项的系数通常不是1。</span></p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name">
<col class="field-body">
<tbody valign="top">
<tr class="field-odd field"><th class="field-name"><span class="yiyi-st" id="yiyi-24">参数：</span></th><td class="field-body"><p class="first"><span class="yiyi-st" id="yiyi-25"><strong>根</strong>：array_like</span></p>
<blockquote>
<div><p><span class="yiyi-st" id="yiyi-26">包含根的序列。</span></p>
</div></blockquote>
</td>
</tr>
<tr class="field-even field"><th class="field-name"><span class="yiyi-st" id="yiyi-27">返回：</span></th><td class="field-body"><p class="first"><span class="yiyi-st" id="yiyi-28"><strong>out</strong>：ndarray</span></p>
<blockquote class="last">
<div><p><span class="yiyi-st" id="yiyi-29">1-D数组的系数。</span><span class="yiyi-st" id="yiyi-30">如果所有根都是实数，则<em class="xref py py-obj">out</em>是一个真实的数组，如果一些根是复数，则<em class="xref py py-obj">out</em>是复数，即使结果中的所有系数都是实数下面的例子）。</span></p>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
<div class="admonition seealso">
<p class="first admonition-title"><span class="yiyi-st" id="yiyi-31">也可以看看</span></p>
<p class="last"><span class="yiyi-st" id="yiyi-32"><code class="xref py py-obj docutils literal"><span class="pre">polyfromroots</span></code>，<code class="xref py py-obj docutils literal"><span class="pre">chebfromroots</span></code>，<code class="xref py py-obj docutils literal"><span class="pre">lagfromroots</span></code>，<code class="xref py py-obj docutils literal"><span class="pre">hermfromroots</span></code>，<code class="xref py py-obj docutils literal"><span class="pre">hermefromroots.</span></code></span></p>
</div>
<p class="rubric"><span class="yiyi-st" id="yiyi-33">例子</span></p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">import</span> <span class="nn">numpy.polynomial.legendre</span> <span class="k">as</span> <span class="nn">L</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">L</span><span class="o">.</span><span class="n">legfromroots</span><span class="p">((</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">))</span> <span class="c1"># x^3 - x relative to the standard basis</span>
<span class="go">array([ 0. , -0.4,  0. ,  0.4])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">j</span> <span class="o">=</span> <span class="nb">complex</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">1</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">L</span><span class="o">.</span><span class="n">legfromroots</span><span class="p">((</span><span class="o">-</span><span class="n">j</span><span class="p">,</span><span class="n">j</span><span class="p">))</span> <span class="c1"># x^2 + 1 relative to the standard basis</span>
<span class="go">array([ 1.33333333+0.j,  0.00000000+0.j,  0.66666667+0.j])</span>
</pre></div>
</div>
</dd></dl>
